package com.example.tangyangkai.testdemo;

import android.content.Intent;
import android.os.Bundle;

import com.okmin.base.BaseActivity;
import com.okmin.base.BaseFragment;
import com.okmin.base.R;


/**
 * Created by tangyangkai on 16/5/4.
 */
public abstract class AppActivity extends BaseActivity {

    //获取第一个fragment
    protected abstract BaseFragment getFirstFragment();

    //获取Intent
    protected void handleIntent(Intent intent) {

    }

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
//            setContentView(getContentViewId());
            if (null != getIntent()) {
                handleIntent(getIntent());
            }
            //避免重复添加Fragment
            if (null == getSupportFragmentManager().getFragments()) {
                BaseFragment firstFragment = getFirstFragment();
                if (null != firstFragment) {
                    addFragment(firstFragment);
                }
            }

        }
    @Override
    protected int getLayoutId() {
        return R.layout.item_recyclerview;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void loadData() {

    }
}
